package cn.edu.hunau.java.week03.day03;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class CountCharNumberTest {

    @Test
    public void testCountCharNumbers(){
        CountCharNumbers("abcabc123123123");

        System.out.println();
    }

    public Map<Character,Integer> CountCharNumbers(String str){
        Map<Character,Integer> map=new HashMap<>();
        for(int i=0;i<str.length();i++){
            char c=str.charAt(i);
            Integer value=map.get(c);
            map.put(c,value==null?1:value+1);
        }
        return map;
    }
}
